<template>
	<view class="main">
		<view class="box">
			<view class="item">
				<view class="che"><van-checkbox v-model="checked" checked-color="#085710"></van-checkbox></view>
				<view class="img">
					<image src="../../static/nike.webp" mode=""></image>
				</view>
				<view class="info">
					<view class="info-text">
						<view class="tx1">Nike Air Force 1 '07 PRM男子空军一号运动鞋</view>
						<view class="tx2">
							<text>42.5</text> <text><image src="../../static/font/xb.png"></image></text>
						</view>
						<view class="tx3">
							<text>589.00</text>
						</view>
					</view>
					<view class="seal">
						<van-stepper v-model="value" theme="round" button-size="26" disable-input />
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				checked:false,
				value:1,
			}
		},
		methods: {
			// 检测用户是否登录了
			IsLogin(){
				const that = this
				uni.getStorage({
					key:'isLogin',
					//获取状态
					success(res) {
						if(res.data == false){ // 表示用户没有登录
							that.$notify({ type: 'warning', message: '请先登录,三秒后跳到登录页面' });
							let second = 3
							const timer = setInterval(()=>{
								second--
								if(!second){
									clearInterval(timer)
									uni.navigateTo({
										url:'/pages/login/login'
									})	
								}
							},1000)
						}
					},
					// 获取本地数据失败,用户可能是第一次登录
					fail() {
					that.$notify({ type: 'warning', message: '请先登录,三秒后跳到登录页面' });
					let second = 3
					const timer = setInterval(()=>{
						second--
						if(!second){
							clearInterval(timer)
							uni.navigateTo({
								url:'/pages/login/login'
							})	
						}
					},1000)
				}
				})
			}
		},
		// 页面显示的生命周期
		onShow(){
			this.IsLogin()
		},
		// // 页面加载的生命周期 ,这个生命周期只会触发一次
		// onLoad() {
		// 	this.IsLogin()
		// }
	}
</script>

<style lang="less">
	.main{
		width: 100%;
		height: 90vh;
		background: #f3f3f3;
	}
	.box{
		padding-top: 20px;
		display: flex;
		justify-content: center;
	}
	.box .item{
			margin: 10px 0;
			padding: 0 10px;
			width: 90%;
			height: 200rpx;
			border-radius: 10px;
			background-color: white;
			display: flex;
			align-items: center;
			justify-content: space-between;
			
			.che{
				width: 30px;
			}
			.img image{
				width: 260rpx;
				height: 180rpx;
				border-radius: 10px;
			}
			.info{
				margin-left: 10px;
				width: 340rpx;
				height: 180rpx;
				// background: black;
				display: flex;
				justify-content: space-between;
			}
		}
		.info-text{
			width: 80%;
			height: 100%;
			// background: black;
			.tx1{
				height: 80rpx;
				font-size: 1rem;
				 display: -webkit-box;
				-webkit-box-orient: vertical;
				-webkit-line-clamp: 2;
				overflow-y: hidden;
			}
			.tx2{
				padding: 0 5px;
				width: 60px;
				height: 30px;
				border-radius: 5px;
				background: #f3f3f3;
				display: flex;
				justify-content: space-between;
				align-items: center;
				image{
					width: 18px;
					height: 18px;
				}
			}
			.tx3{
				height: 30px;
				line-height: 30px;
			}
		}
		.seal{
			width: 17%;
			height: 100%;
			display: flex;
			justify-content: center;
			align-items: center;
			// background: pink;
		}
</style>
